Visual Basic (Declaration) | |
---|---|
Public Overloads Function Run( _ ByVal input As TextReader, _ ByVal ParamArray arguments() As String _ ) As Integer |
C# | |
---|---|
public int Run( TextReader input, params string[] arguments ) |
Parameters
- input
- arguments
Library/Library.Test/TestAssemblyRunner.cs
C# | Copy Code |
---|---|
using (AssemblyRunner runner = new AssemblyRunner(Exe)) { List<string> lines = new List<string>(); runner.OutputReceived += delegate(Object o, ProcessOutputEventArgs e) { lines.Add(e.Data); }; int exitCode = runner.Run(new StringReader("Hello World\r\nWhatever!\r\nAnother line.")); Assert.AreEqual(0, exitCode); // 0 == WorkingDirectory = // 1 == std-input: Assert.AreEqual("Hello World", lines[2]); Assert.AreEqual("Whatever!", lines[3]); Assert.AreEqual("Another line.", lines[4]); } |
VB.NET | Copy Code |
---|---|
Using runner As New AssemblyRunner(Exe) Dim lines As New List(Of String)() runner.OutputReceived += Function(o As [Object], e As ProcessOutputEventArgs) Do lines.Add(e.Data) End Function Dim exitCode As Integer = runner.Run(New StringReader("Hello World" & vbCr & vbLf & "Whatever!" & vbCr & vbLf & "Another line.")) Assert.AreEqual(0, exitCode) ' 0 == WorkingDirectory = ' 1 == std-input: Assert.AreEqual("Hello World", lines(2)) Assert.AreEqual("Whatever!", lines(3)) Assert.AreEqual("Another line.", lines(4)) End Using |
Target Platforms: Windows XP, Windows Server 2003, Windows Vista, Windows Server 2008, Windows 7
Reference
AssemblyRunner ClassAssemblyRunner Members
Overload List